package br.com.cicero.notasfiscais.mb;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.primefaces.component.datatable.DataTable;
import org.primefaces.model.LazyDataModel;

import br.com.cicero.notasfiscais.dao.DAO;
import br.com.cicero.notasfiscais.datamodel.DataModelNotasFiscais;
import br.com.cicero.notasfiscais.modelo.NotaFiscal;

@Named
@RequestScoped
public class ListaNotasFiscaisBean implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Inject
	private LazyDataModel<NotaFiscal> dataModel;
		
	@Inject
	private DAO<NotaFiscal> dao;
	
	private DataTable tabela;
	
	@PostConstruct
	public void init() {
		this.dataModel.setRowCount(dao.contaTodos());
		this.dataModel.setPageSize(5);
	}

	public ListaNotasFiscaisBean() {
		this.dataModel = new DataModelNotasFiscais();
	}
	
	public LazyDataModel<NotaFiscal> getDataModel() {
		return dataModel;
	}
	
}
